//package com.smallkingson.ylib.view.utils;
//
//import android.support.annotation.Nullable;
//import android.support.v7.util.DiffUtil;
//
//import java.util.List;
//
//public class YDiffCallback<T extends YDiffCallback.DiffComparable> extends DiffUtil.Callback {
//
//    private final List<T> oldList;
//    private final List<T> newList;
//
//    public YDiffCallback(List<T> oldList, List<T> newList) {
//        this.oldList = oldList;
//        this.newList = newList;
//    }
//
//    @Override
//    public int getOldListSize() {
//        return oldList.size();
//    }
//
//    @Override
//    public int getNewListSize() {
//        return newList.size();
//    }
//
//    @Override
//    public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
////        return oldList.get(oldItemPosition).getId() == newList.get(newItemPosition).getId();
//        return oldList.get(oldItemPosition).areTheSame(newList.get(newItemPosition));
//    }
//
//    @Override
//    public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
//        return oldList.get(oldItemPosition).areContentsTheSame(newList.get(newItemPosition));
//    }
//
//    @Nullable
//    @Override
//    public Object getChangePayload(int oldItemPosition, int newItemPosition) {
//        // Implement method if you're going to use ItemAnimator
//        return super.getChangePayload(oldItemPosition, newItemPosition);
//    }
//
//    public static interface DiffComparable<V extends DiffComparable> {
//        boolean areTheSame(V newItem);
//
//        boolean areContentsTheSame(V newItem);
//    }
//}
